#-*- coding:utf-8 -*-

import os
# configuration
basedir = os.path.abspath(os.path.dirname(__file__))

class Config:
    DATABASE = 'exam.db'
    DEBUG = True
    USERNAME = os.environ.get('DB_USERNAME', 'admin')
    PASSWORD = os.environ.get('DB_PASSWORD', 'admin')
    IMGUPDIR = 'UploadImages'
    SQLALCHEMY_DATABASE_URI = 'sqlite:////' + os.path.join(basedir, DATABASE)
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    SECRET_KEY = os.environ.get('SECRET_KEY', 'hard to guess string')
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    FLASKY_ADMIN = os.environ.get('FLASKY_ADMIN')

    @staticmethod
    def init_app(app):
        pass

class DevelopmentConfig(Config): 
    DEBUG = True    
    SQLALCHEMY_DATABASE_URI = os.environ.get(
        'DEV_DATABASE_URL',
        'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite'))

class TestingConfig(Config):
    TESTING = True
    SQLALCHEMY_DATABASE_URI = os.environ.get(
        'TEST_DATABASE_URL',
        'sqlite:///' + os.path.join(basedir, 'data-test.sqlite'))

class ProductionConfig(Config):
    SQLALCHEMY_DATABASE_URI = os.environ.get(
        'DATABASE_URL',
        'sqlite:///' + os.path.join(basedir, 'data.sqlite'))

config = {
    'development': DevelopmentConfig,
    'testing': TestingConfig,
    'production': ProductionConfig,
    'default': DevelopmentConfig
}